<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>手风琴案例</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .menuGroup{
            width: 200px;
            text-align: center;
            border: 1px solid #333;
        }
        .groupTitle{
            background-color: lightskyblue;
            display: block;
        }
        .menuGroup > div {
            height: 200px;
            background-color: #fff;
            display: none;
        }
    </style>
</head>
<body>
    <ul class="parentWrap">
        <li class="menuGroup">
            <span class="groupTitle">标题1</span>
            <div>内容1</div>
        </li>
        <li class="menuGroup">
            <span class="groupTitle">标题2</span>
            <div>内容2</div>
        </li>
        <li class="menuGroup">
            <span class="groupTitle">标题3</span>
            <div>内容3</div>
        </li>

    </ul>
</body>
<script src="jquery-3.3.1.min.js"></script>
<script>
    $(function () {
        // 点击标题li 对应的div显示 他的兄弟li下面的div隐藏
        $('.parentWrap > .menuGroup').click(function () {
            // jquery特性：链式编程
            $(this).children('div').slideDown(500).parent().siblings('li').children('div').slideUp(500);
        })
    })
</script>
</html>